using System;
using System.IO;
using System.Text;

namespace EasyPath_CSharp
{
    class FileUtils
    {
        public const String CONFIG_FILE_NAME = "EasyPath.json";

        /*
         * 读取文件内容
         */
        public static String read()
        {

            StreamReader streamReader = new StreamReader(CONFIG_FILE_NAME, Encoding.UTF8);
            StringBuilder stringBuilder = new StringBuilder();

            while(!streamReader.EndOfStream)
            {
                stringBuilder.Append(streamReader.ReadLine());
            }
            streamReader.Dispose();

            return stringBuilder.ToString();
        }

        /*
         * 写入内容到文件
         */
        public static void write(String config)
        {
            File.WriteAllText(CONFIG_FILE_NAME, config);
        }
    }
}
